<template>
	<view :style="{paddingTop: (navH+46)+'px'}">
		<view class='nav' :style="{paddingTop:navH+'px'}">
			<view class="nav-back" style="width: 100px;position: fixed">
				<view class="nav-head">
					<open-data type="userAvatarUrl"></open-data>
				</view>
				<view @click="goUrl('canvas')">个人中心</view>
			</view>
			<view class='nav-title'>
				微言课堂
			</view>
		</view>
		<view class="team-text">我的团队</view>
		<scroll-view scroll-x="true" class="team-wrap">
				<view v-for="item in teams" style="margin-left: 30upx;display: inline-block" @click="goTab(item)">
					<image  class="team-image"
						   :src="item.coverImage">
					</image>
					<view class="team-name">{{item.name}}</view>
					<view class="team-remark">{{item.intro}}</view>
				</view>
		</scroll-view>
		<view class="add-team" @click="goUrl('cooperation')">创建团队</view>
		<view class="company">- 云汀科技技术支持 -</view>
	</view>
</template>

<script>
	import API from '../../common/api.js';
	export default {
		components:{
		},
		data() {
			return {
				navH:0,
				teams:[]
			}
		},
		onLoad(options){
			console.log(options,4444444)
			uni.showModal({
				title: '提示',
				content: JSON.stringify(options),
				showCancel: false,
			});
			return
			this.navH=this.navHeight()
			if(!uni.getStorageSync('token')){
				uni.reLaunch({
					url: '../index/accredit'
				});
			}else{
				this.getUserMy()
			}
		},
		methods:{
			getUserMy(){
				API.userMy({
					token:uni.getStorageSync('token')}).then(res=>{
					console.log(res,110000)
					if(res.status==200){
						this.teams=res.data.teams
					}else{
						uni.hideLoading()
						uni.showModal({
							title: '提示',
							content: '请求失败！',
							showCancel: false,
						});
					}
				})
			},
			goUrl(url){
				uni.navigateTo({
					url: '../index/'+url
				});
			},
			goTab(item){
				uni.setStorage({
					key: 'team',
					data: JSON.stringify(item),
					success: function () {
						uni.switchTab({
							url: '../index/team'
						});
					}
				});
			}
		}
	}
</script>

<style>
	.team-text{
		padding:30upx 0 0 30upx ;
		color: rgba(16, 16, 16, 1);
		font-size: 40upx;
		font-family: PingFangSC-bold;
	}
	.team-wrap{
		padding: 40upx 0 240upx 0;
		width: 100%;
		white-space: nowrap;
	}
	.team-image{
		width:75vw;
		height:46.48vw;
		border-radius:20upx;
	}
	.team-name{
		margin-top: 6upx;
		color: rgba(16, 16, 16, 1);
		font-size: 36upx;
		font-family: PingFangSC-bold;
	}
	.team-remark{
		color: rgba(181, 181, 181, 1);
		font-size: 24upx;
		font-family: PingFangSC-regular;
	}
	.add-team{
		color: rgba(221, 13, 18, 1);
		position: absolute;
		width: 100%;
		bottom: 300upx;
		font-size: 60upx;
		text-align: center;
		font-family: 方正汉真广标-标准;
	}
	.company{
		position: absolute;
		width: 100%;
		bottom: 40upx;
		color: rgba(157, 157, 157, 1);
		font-size: 28upx;
		text-align: center;
		font-family: PingFangSC-regular;
	}
</style>
